package com.fdd.op.sdk.request.api.contract;

import com.fdd.op.sdk.ApiRuleException;
import com.fdd.op.sdk.BaseFddRequest;
import com.fdd.op.sdk.constants.Constants;
import com.fdd.op.sdk.internal.mapping.RequestField;
import com.fdd.op.sdk.internal.util.StringUtils;
import com.fdd.op.sdk.response.api.contract.ApplyEvidenceResponse;

import java.util.Map;

public class ApplyEvidenceRequest extends BaseFddRequest<ApplyEvidenceResponse> {
    @Override
    public String getApiMethodName() {
        return "/base/api/contract/applyEvidence";
    }

    @Override
    public Map<String, Object> getTextParams() {
        return null;
    }

    @Override
    public Class<ApplyEvidenceResponse> getResponseClass() {
        return ApplyEvidenceResponse.class;
    }

    @Override
    public void check() throws ApiRuleException {
        if(StringUtils.isBlank(getNotifyUrl())){
            throw new ApiRuleException("2", "参数验证失败，notifyUrl不能为空");
        }
        if(StringUtils.isBlank(getNotifyNo())){
            throw new ApiRuleException("2", "参数验证失败，notifyNo不能为空");
        }
        if(StringUtils.isBlank(getDocId()) && StringUtils.isBlank(getTpDocId())){
            throw new ApiRuleException("34001", "docId和tpDocId至少传一个！");
        }
    }

    @Override
    public String getHttpMethod() {
        return Constants.METHOD_POST;
    }

    @RequestField
    private String docId;

    @RequestField
    private String tpDocId;

    @RequestField
    private String companyId;

    @RequestField
    private String tpOrgId;

    @RequestField
    private String accessCode;

    @RequestField
    private String notifyUrl;

    @RequestField
    private String notifyNo;

    @RequestField
    private String reportType;

    public String getDocId() {
        return docId;
    }

    public void setDocId(String docId) {
        this.docId = docId;
    }

    public String getTpDocId() {
        return tpDocId;
    }

    public void setTpDocId(String tpDocId) {
        this.tpDocId = tpDocId;
    }

    public String getCompanyId() {
        return companyId;
    }

    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }

    public String getTpOrgId() {
        return tpOrgId;
    }

    public void setTpOrgId(String tpOrgId) {
        this.tpOrgId = tpOrgId;
    }

    public String getAccessCode() {
        return accessCode;
    }

    public void setAccessCode(String accessCode) {
        this.accessCode = accessCode;
    }

    public String getNotifyUrl() {
        return notifyUrl;
    }

    public void setNotifyUrl(String notifyUrl) {
        this.notifyUrl = notifyUrl;
    }

    public String getNotifyNo() {
        return notifyNo;
    }

    public void setNotifyNo(String notifyNo) {
        this.notifyNo = notifyNo;
    }

    public String getReportType() {
        return reportType;
    }

    public void setReportType(String reportType) {
        this.reportType = reportType;
    }
}
